﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WikiCsharpCommon
{
    public class WikiCsharpBugtrackerConfiguration
    {
        private string file_extension_ = ".txt";
        private string[] bug_possible_states_ = { "New", "Open", "Done", "Close" };

        private string homepageTemplate = "+Bug Tracker\r\n[[buglist][Full bugs list]]\r\n[^buglist-peruser]\r\n";
        private string perUserTemplate = "+Per User\r\n[<<!--%%ADDUSER%%-->>]\r\n";
        private string userTemplate = "[[buglist-%%USERNAME%%][%%FULLNAME%%]]\r\n[<<!--%%ADDUSER%%-->>]";
        private string mainBugListTemplate = "+Bugs List - [{%%LISTNAME%%}]\r\n[^%%LISTPREFIX%%New]\r\n[^%%LISTPREFIX%%Open]\r\n[^%%LISTPREFIX%%Done]\r\n[^%%LISTPREFIX%%Close]\r\n";

        private string bugTemplate = "+++Information\r\n|BugID|State|Version|Version[<<br/>>]Corrected|Reporter|Assignee\r\n|%%BUGID%%| [<<!--%%STARTBUGSTATE%%-->>][{}][<<!--%%ENDBUGSTATE%%-->>] | [<<!--%%STARTVERSION%%-->>][{}][<<!--%%ENDVERSION%%-->>] | [<<!--%%STARTCORRECTED%%-->>][{}][<<!--%%ENDCORRECTED%%-->>] | [<<!--%%STARTREPORTER%%-->>][{}][<<!--%%ENDREPORTER%%-->>] | [<<!--%%STARTASSIGNEE%%-->>][{}][<<!--%%ENDASSIGNEE%%-->>]\r\n\r\n[<<button OnClick=\"submitOpen('%%BUGID%%')\">Open</button><button OnClick=\"submitDone('%%BUGID%%')\">Done</button><button OnClick=\"submitClose('%%BUGID%%')\">Close</button>>]\r\n\r\n+++Description\r\n|Summary|[<<!--%%STARTSUMMARY%%-->>][{}][<<!--%%ENDSUMMARY%%-->>]\r\n|Description|[<<!--%%STARTDESCRIPTION%%-->>][{}][<<!--%%ENDDESCRIPTION%%-->>]\r\n\r\n+++Notes\r\n|Date|User|Notes|Action\r\n[<<!--NEXT NOTES-->>]\r\n\r\n[<<button OnClick=\"submitAddNote('%%BUGID%%')\">Add Notes</button>>]\r\n\r\n+++Files\r\n|Date|User|Files|Action\r\n[<<!--NEXT FILES-->>]\r\n\r\n[<<button OnClick=\"submitAddFile('%%BUGID%%')\">Add Files</button>>]\r\n\r\n+++History\r\n|Date|User|Changes\r\n[<<!--NEXT CHANGES-->>]\r\n\r\n";
        private string noteTemplate = "|[{%%DATE%%}]|[{%%USERNAME%%}]|[<<!--%%STARTNOTEID%%-->>][{}][<<!--%%ENDNOTEID%%-->>]|[<<button disabled=\"true\" OnClick=\"submitEditNotes('%%BUGID%%', '%%NOTEID%%')\">Edit</button>>][<<button OnClick=\"submitDeleteNotes('%%BUGID%%', '%%NOTEID%%')\">Delete</button>>]\r\n[<<!--NEXT NOTES-->>]";
        private string fileTemplate = "|[{%%DATE%%}]|[{%%USERNAME%%}]|[<<!--%%STARTFILEID%%-->>][{}][<<!--%%ENDFILEID%%-->>]|[<<button OnClick=\"submitOpenFiles('%%BUGID%%', '%%FILEID%%')\">Open</button>>][<<button OnClick=\"submitDownloadFiles('%%BUGID%%', '%%FILEID%%')\">Download</button>>][<<button OnClick=\"submitDeleteFiles('%%BUGID%%', '%%FILEID%%')\">Delete</button>>]\r\n[<<!--NEXT FILES-->>]";
        private string changesTemplate = "|[{%%DATE%%}]|[{%%USERNAME%%}]|[{%%CHANGES%%}]\r\n[<<!--NEXT CHANGES-->>]";
        private string bugListTemplate = "+++[{%%LISTNAME%%}]\r\n|Bug ID|State|Version|Corrected|Summary|Reporter|Assignee|Action[<<!--ADDBUGINLIST-->>]";
        private string bugInListTemplate = "[<<!--ADDBUGINLIST-->>]\r\n|[%%BUGID%%]|[<<!--%%STARTBUGSTATE%%-->>][{}][<<!--%%ENDBUGSTATE%%-->>]|[<<!--%%STARTVERSION%%-->>][{}][<<!--%%ENDVERSION%%-->>]|[<<!--%%STARTCORRECTED%%-->>][{}][<<!--%%ENDCORRECTED%%-->>]|[<<!--%%STARTSUMMARY%%-->>][{}][<<!--%%ENDSUMMARY%%-->>]|[<<!--%%STARTREPORTER%%-->>][{}][<<!--%%ENDREPORTER%%-->>]|[<<!--%%STARTASSIGNEE%%-->>][{}][<<!--%%ENDASSIGNEE%%-->>]|[<<button OnClick=\"submitOpen('%%BUGID%%')\">Open</button><button OnClick=\"submitDone('%%BUGID%%')\">Done</button><button OnClick=\"submitClose('%%BUGID%%')\">Close</button>>]";

        
        public String FileExtension
        {
            get { return file_extension_; }
            set { file_extension_ = value; }
        }

        public String[] BugPossibleStates
        {
            get { return bug_possible_states_; }
            set { bug_possible_states_ = value; }
        }
    }
}
